import random

class Deck:

    def __init__(self):
        self.cards = []
        self.generateDeck()

    def generateDeck(self, decks=1):
        for iii in range(decks):
            for i in range(4):
                for ii in range(9):
                    self.cards.append( (self.cardSuit(i), str(2+ii)) )
                self.cards.append( (self.cardSuit(i), 'J') )
                self.cards.append( (self.cardSuit(i), 'Q') )
                self.cards.append( (self.cardSuit(i), 'K') )
                self.cards.append( (self.cardSuit(i), 'A') )

    def cardSuit(self, suit):
        if suit == 0:
            return 'S'
        elif suit == 1:
            return 'H'
        elif suit == 2:
            return 'C'
        elif suit == 3:
            return 'D'
        else:
            raise ValueError
            
    def shuffle(self):
        random.shuffle(self.cards)
        
    def dealTo(self, _list, _amount):
        for i in range(_amount):
            _list.append(self.cards.pop())
            
    def length(self):
        return len(self.cards)

    def discard(self):
        self.cards = []
        
    
